library flutter_base;

import 'package:flutter/material.dart';
import 'package:tiktokadult/hj_utils/light_model.dart';

// export 'package:flutter_app/common/image/image_loader.dart';

//player

class FlutterBase {
  static bool isRelease = true;
  static const String basePkgName = "flutter_base";
  static bool proxyEnable = false;
  //"PROXY 192.168.1.150:8888"
  static String proxyUrl = "";
  static final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();

  /// [core] 核心线程数量 -1,不创建携程;0,跟随系统cpu数量创建
  static Future init({int core = -1}) async {
    isRelease = const bool.fromEnvironment("dart.vm.product");
    await lightKV.init();
    //FijkLog.setLevel(FijkLogLevel.Silent);
    if (-1 != core) {
      //await Executor().warmUp(processorsNumber: core);
    }
  }

  /// 获取顶层BuildContext
  static BuildContext? get appContext => navigatorKey.currentState?.overlay?.context;

  ///[url] "PROXY 192.168.1.150:8888"
  static setDioProxy(bool enable, String url) {
    proxyEnable = enable;
    proxyUrl = url;
  }
}
